package linkedhashmap;

import java.util.LinkedHashMap;
import java.util.Set;
 /**
 * Created by 5406160@qq.com on LiBoWen 李博闻.
 *
 * @ClassName : LinkedHashMapDemo
 * @Author : 54061
 * @Date: 2022/2/11 18:08
 */
 public class LinkedHashMapDemo {
     public static void main(String[] args) {
         //创建对象
         LinkedHashMap<String, String> hm = new LinkedHashMap<>();
         System.out.println("hm = " + hm);
         //添加元素
         System.out.println("hm.put(\"奶量\",\"璐璐\") = " + hm.put("奶量", "璐璐"));//null
         hm.put("Pone", "璐璐");
         hm.put("暴强", "荣荣");
         hm.put("宇帆", "白盒");
         System.out.println("hm.put(\"暴强\",\"小网红\") = " + hm.put("暴强", "小网红"));//荣荣
         System.out.println("hm = " + hm);//{}


         //召集所有的丈夫.再丈夫找媳妇
         Set<String> Keys = hm.keySet();
         for (String key : Keys) {
             //丈夫找媳妇
             String value = hm.get(key);
             System.out.println("value = " + value);

         }

     }
 }
